<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<div id="onDiv">
	<!-- 订单信息输入框 -->
	<div role="tabpanel" class="tab-pane" id="chan">
		<div class="check-div">
			<br><br>
		</div>
		<div id="onInputDiv" style="padding: 50px 0;margin-top: 50px;background-color: #fff; text-align: right;width: 420px;margin: 50px auto;">
			<div class="form-horizontal">
				<div class="form-group">
					<label for="reserveId" class="col-xs-4 control-label">订单id:</label>
					<div class="col-xs-5">
						<input type="text" class="form-control input-sm duiqi" id="reserveId" placeholder="" style="margin-top: 7px;">
					</div>
				</div>
				<div class="form-group">
					<label for="reservePass" class="col-xs-4 control-label">订单密码：</label>
						<div class="col-xs-5">
							<input type="text" class="form-control input-sm duiqi" value='' id="reservePass" />
						</div>
				</div>
				<div class="form-group text-right">
					<div class="col-xs-offset-4 col-xs-5" style="margin-left: 169px;">
						<button id="onResBut" class="btn btn-xs btn-green">提交</button>
					</div>
				</div>
			</div>>
		</div>
	</div>
	<!-- 入住信息输入框 -->
	<div role="tabpanel" class="tab-pane" id="chan">
		<div id="reserveInforDiv" style="padding: 50px 0;margin-top: 50px;background-color: #fff; text-align: right;width: 420px;margin: 50px auto;">
			<div class="form-horizontal">
				<div class="form-group">
					<label for="" class="col-xs-4 control-label">订单编号:</label>
					<div class="col-xs-5">
						<label id="onOrderId" class="col-xs-4 control-label"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-xs-4 control-label">总金额:</label>
					<div class="col-xs-5">
						<label id="onCost" class="col-xs-4 control-label"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-xs-4 control-label">房间名称:</label>
					<div class="col-xs-5">
						<label id="onRoomName" class="col-xs-4 control-label"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-xs-4 control-label">预定入住日期:</label>
					<div class="col-xs-5">
						<label id="onOriInDate" class="col-xs-4 control-label"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-xs-4 control-label">预定离店日期:</label>
					<div class="col-xs-5">
						<label id="onOutDate" class="col-xs-4 control-label"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="resPhone" class="col-xs-4 control-label">联系电话:</label>
						<div class="col-xs-5">
							<input type="text" class="form-control input-sm duiqi" id="resPhone" placeholder="" style="margin-top: 7px;">
						</div>
				</div>
				<div class="form-group">
					<label for="resIdCardNo" class="col-xs-4 control-label">身份证号:</label>
						<div class="col-xs-5">
							<input type="text" class="form-control input-sm duiqi" id="resIdCardNo" placeholder="" style="margin-top: 7px;">
						</div>
				</div>
				<div class="form-group">
					<label for="reservePass" class="col-xs-4 control-label">备注:</label>
						<div class="col-xs-5">
							<textarea class="form-control input-sm duiqi" cols='20' rows='20' id='resComment'></textarea>
						</div>
				</div>
				<div class="form-group text-right">
					<div class="col-xs-offset-4 col-xs-5" style="margin-left: 169px;">
						<button  class="btn btn-xs btn-green" id='onCheckBut'>入住</button>
						<button  class="btn btn-xs btn-white" id='onCancelBut'>取消</button>
					</div>
				</div>
			</div>>
		</div>
	</div>
</div>
<style>
	#reserveInforDiv{
		display:none;
	}
</style>
<script>
$("#onResBut").click(function(){
	$.post("/hotel/checkIn/getReserve",{'id':$("#reserveId").val(),'password':$("#reservePass").val()},function(str){
		var res=eval('(' +str + ')')
		if(res.code!=0){
			alert(res.message)
			return;
		}else{
			res=res.object
			$('#onInputDiv').css('display','none')
			$('#reserveInforDiv').css('display','block')
			$('#onOrderId').text(res.orderId)
			$('#onRoomName').text(res.roomName)
			$('#onCost').text(res.price)
			$('#onOriInDate').text(res.inDate)
			$('#onOutDate').text(res.outDate)
			$('#resPhone').val(res.phone)
			$('#resComment').val(res.zcomment)
		}
	})
})
	
$('#onCancelBut').click(function(){
	$("#reservePass").val('')
	$("#reserveId").val('')
	$('#onInputDiv').css('display','block')
	$('#reserveInforDiv').css('display','none')
})

$('#onCheckBut').click(function(){
	data={'orderId':$('#onOrderId').text(),'phone':$('#resPhone').val(),'idCardNo':$('#resIdCardNo').val(),
			'zcomment':$('#resComment').val()
	}
	$.post("/hotel/checkIn/onlineCheck",data,function(str){
		//alert(str)
		var res=eval('(' +str + ')')
		if(res.code!=0){
			alert(res.message)
			//refreshTypeList()
			return;
		}else{
			window.location.href="/hotel/system/mainPage"
		}
		})
	})
</script>


